package com.sbck.cs3;

import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.sbck.cs3.MyClass.MyOpenHelper;
import com.sbck.cs3.fragment.DeviceSelectFragment;
import com.sbck.cs3.fragment.LoginFragment;

public class DeviceSelectActivity extends AppCompatActivity {

    DeviceSelectFragment deviceSelectFragment;

    LoginFragment loginFragment;
    MyOpenHelper myOpenHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_deviceselect);

        MyGlobal.setting = new Setting();

        myOpenHelper = new MyOpenHelper(this);


        //Fragment New
        deviceSelectFragment = new DeviceSelectFragment();

        loginFragment = new LoginFragment();

        //跳转主界面
        getFragmentManager().beginTransaction().replace(R.id.fl_DeviceSelect_container,
                loginFragment).commit();
    }


    public void Btn_Setting_Save(View view)
    {

        MyOpenHelper openHelper = new MyOpenHelper(DeviceSelectActivity.this);

        openHelper.Update_Setting();

        getFragmentManager().beginTransaction().replace(R.id.fl_DeviceSelect_container,deviceSelectFragment).commitNowAllowingStateLoss();

    }

    public void Btn_Setting_Cancel(View view) {

        getFragmentManager().beginTransaction().replace(R.id.fl_DeviceSelect_container, deviceSelectFragment).commitNowAllowingStateLoss();
    }
}